﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DataAccess;
namespace BAL
{
    public class BAL
    {

        public DAL ac = new DAL();
        public void Insert(string ID, string Pass)
        {

            string sql = "Insert into accout1 values('" + ID + "','" + Pass + "')";
            ac.KetNoi();
            ac.ExcutinonQuery(sql);
        }
        public void Update(string Id, string Pass)
        {
            string sql = "Update Accout1 set Pass='" + Pass + "' where Id='" + Id + "'";
            ac.KetNoi();
            ac.ExcutinonQuery(sql);
        }
        public void Delete(string Id)
        {
            ac.KetNoi();
            string sql = "Detele from accout1 where ID='" + Id + "'";
            ac.ExcutinonQuery(sql);
        }
        public DataTable LayDuLieu(string sql)
        {
            DataTable dt = new DataTable();
            OleDbConnection con = ac.KetNoi();
            con.Open();
            OleDbDataAdapter accout = new OleDbDataAdapter(sql, con);
            accout.Fill(dt);
            return dt;
        }

        public OleDbDataReader Reader(string sql)
        {
           OleDbConnection con= ac.KetNoi();
           con.Open();
            OleDbCommand comman = new OleDbCommand(sql,con);
            OleDbDataReader read = comman.ExecuteReader();
            read.Read();
            return read;


        }

        

    }
}
